﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using NetFtp.Core.Login;

public partial class NewAccount : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["USER_LOGIN"] == null)
            Response.Redirect("Default.aspx");
    }
    protected void cmdOk_Click(object sender, EventArgs e)
    {
        UserList liste = new UserList();
        User tmp = liste.ReturnUser(Session["USER_LOGIN"].ToString());
        int port;

        int.TryParse(txtPort.Text, out port);
        if (port == 0)
            port = 21;

        FtpAccount account = new FtpAccount(txtHote.Text, txtUser.Text, txtMdp.Text, port, txtFolder.Text);

        tmp.AddFtpAccount(account);

        Response.Redirect("UserAccount.aspx");
    }
}
